package jf.collections.range;

import java.util.Iterator;

/**
 * @author ivanalx
 * @date 02.06.2009 14:45:28
 */
public class DoubleRange implements Iterable<Double>{
	private double from;
	private double to;
	private double step;

	public DoubleRange(double from, double to, double step) {
		this.from = from;
		this.to = to;
		this.step = step;
	}

	public DoubleRange(double from, double to) {
		this.from = from;
		this.to = to;
		this.step = 1;
	}

	@Override
	public Iterator<Double> iterator() {
		return new DoubleRangeIterator(from, to, step);
	}

	public static DoubleRange range(double from, double to, double step) {
		return new DoubleRange(from, to, step);
	}

	public static DoubleRange range(double from, double to) {
		return new DoubleRange(from, to);
	}
}
